<script>
	import {
		initCloud,
	} from "@/utils/cloud";
	import {
		provide
	} from "vue";
	// import { useCloudStore } from "@/store";
	// const { isInitCloud, initCloud } = useCloudStore();

	export default {
		data() {
			return {
				rpx: 0,
				vh: 0,
				safeBottom: 0,
				needRefresh: false
			}
		},
		onLaunch: function() {
			// if (!isInitCloud) initCloud();
			initCloud().then((res) => {
				console.log("initcloud", res);
			});
			//----
			uni.getSystemInfo({
				success: (res) => {
					this.rpx = res.windowWidth * 1000 / 750000 //单位px
					this.vh = res.windowHeight * 1000 / 100000 //单位px
					this.safeBottom = res.safeAreaInsets.bottom; //屏幕底部安全距离
					console.log(this.rpx, this.vh, this.safeBottom, `rpx`, `vh`, `safeBottom`)
					const globalData = {
						rpx: this.rpx,
						vh: this.vh,
						safeBottom: this.safeBottom,
						needRefresh: this.needRefresh,
					}
					provide('globalData', globalData)
				}
			})
		},
		onShow: function() {
			console.log("App Show");
		},
		onHide: function() {
			console.log("App Hide");
		},
	};
</script>

<style>
	/*每个页面公共css */
	page {
		background-color: #f7f8fa !important;
	}
</style>